package com.chaos.eurekaproducer.test;

import java.io.Serializable;

/**
 * @author liaopeng
 * @title: StaticDispatch
 * @projectName eureka-producer
 * @description: TODO
 * @date 2021/6/22下午8:59
 */
public class StaticDispatch {
    static abstract class Human{}

    static class Man extends Human{}

    static class  Woman extends Human{}

    public void sayHello(Human guy){
        System.out.println("hello human");
    }

    public void sayHello(Man guy){
        System.out.println("hello man");
    }

    public void sayHello(Woman guy){
        System.out.println("hello woman");
    }

    public static void main(String[] args) {
        Human man = new Man();
        Human woman = new Woman();
        StaticDispatch sr = new StaticDispatch();
        sr.sayHello(man);
        sr.sayHello(woman);
    }

    public static class Overload{
        //1
        public static void sayHello(char arg){
            System.out.println("hello char");
        }

        //2
        public static void sayHello(int arg){
            System.out.println("hello int");
        }

        //3
        public static void sayHello(long arg){
            System.out.println("hello long");
        }

        //4
        public static void sayHello(Character arg){
            System.out.println("hello Character");
        }

        //5
        public static void sayHello(Serializable arg){
            System.out.println("hello Serializable");
        }

        //6
        public static void sayHello(Object arg){
            System.out.println("hello Object");
        }

        //7
        public static void sayHello(char... arg){
            System.out.println("hello char...");
        }

        public static void main(String[] args) {
            sayHello('a');
        }
    }



}
